package com.lemei.cn.myokhttpbeen.adpter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

import com.lemei.cn.myokhttpbeen.been.FragmentInforBeen;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by 赵航 on 2017/6/6.
 */

public class MyViewPagerAdpter extends FragmentStatePagerAdapter {

    private List<FragmentInforBeen> mShowItems = new ArrayList<>();

    public MyViewPagerAdpter(FragmentManager fm, List<FragmentInforBeen> showItems) {
        super(fm);
        mShowItems = showItems;
    }

    public MyViewPagerAdpter(FragmentManager fm) {
        super(fm);
    }

    @Override
    public Fragment getItem(int position) {
        return mShowItems.get(position).mFragment;
    }

    @Override
    public int getCount() {
        return mShowItems.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return mShowItems.get(position).title;
    }
}
